import { S } from '../../s';
import { IPSAppDEMethod } from '../../app/dataentity/ipsapp-demethod';
import { IPSAppDataEntity } from '../../app/dataentity/ipsapp-data-entity';
import { IPSDEGEIUpdateDetail } from './ipsdegeiupdate-detail';
import { IPSDEGridEditItemUpdate } from './ipsdegrid-edit-item-update';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEGridEditItemUpdateImpl
  extends PSModelObjectImpl
  implements IPSDEGridEditItemUpdate
{
  get codeName(): string {
    return this.M.codeName;
  }

  protected psappdemethod: IPSAppDEMethod;
  getPSAppDEMethod(): IPSAppDEMethod | null {
    if (this.psappdemethod != null) return this.psappdemethod;
    const value = this.M.getPSAppDEMethod;
    if (value == null) {
      return;
    }
    const ipsappdataentity = this.getParentPSModelObject(
      S._f,
    ) as IPSAppDataEntity;
    if (ipsappdataentity != null) {
      this.psappdemethod = ipsappdataentity.findPSAppDEMethod(value);
    }
    return this.psappdemethod;
  }

  protected psdegeiupdatedetails: IPSDEGEIUpdateDetail[];
  getPSDEGEIUpdateDetails(): IPSDEGEIUpdateDetail[] | null {
    return (
      this.psdegeiupdatedetails ||
      (this.psdegeiupdatedetails = this.fillChildListModel(
        this.M.getPSDEGEIUpdateDetails,
        S._c5,
      ) as IPSDEGEIUpdateDetail[])
    );
  }

  findPSDEGEIUpdateDetail(objKey: any): IPSDEGEIUpdateDetail | null {
    return this.getPSModel5(
      S._c5,
      this.getPSDEGEIUpdateDetails(),
      objKey,
    ) as IPSDEGEIUpdateDetail;
  }

  get scriptCode(): string {
    return this.M.scriptCode;
  }

  get customCode(): boolean {
    return this.M.customCode != null ? this.M.customCode : false;
  }

  get showBusyIndicator(): boolean {
    return this.M.showBusyIndicator != null ? this.M.showBusyIndicator : true;
  }
  get cls(): string {
    return 'PSDEGridEditItemUpdateImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._c7) return true;
    return super.instanceof(cls);
  }
}
